package com.ning.weixin.utils;

import java.util.Random;

/**
 * 主键生成工具
 *
 * @author Cyan
 * @Date:2018/12/10
 */
public class KeyUtil {

    //防止高并发状态下重复
    public static synchronized String genUniqueKey() {
        Random random = new Random();
        //生成6位随机数
        Integer number = random.nextInt(900000) + 100000;

        return System.currentTimeMillis() + String.valueOf(number);
    }

}
